Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(core): allow local execution transpiler overriding with env var #16037

Merged

Conversation

yharaskrik
Copy link
Contributor

Current Behavior

Currently the transpiler being picked for local execution is entirely depending on if @swc-node/register' is installed or not. While this works for the overwhelmingly large majority of cases there are times when we may want to force the transpiling to use ts-node even though swc-node is installed. For example in our CI, we use CircleCI arm64 resources to run all of our build steps (as they end up cheaper than the x86/amd64 resources) except for when we dockerize our servers, we dockerize our servers on x86 Docker containers (since they are being deployed to x86 servers so we can't* build them on arm resources). This means that if we have @swc-node/register installed then when our dependencies are installed on arm resources we have arm swc native code compiled which doesn't run when we call local executions in our step that dockerizes (since its x86 and we do not have x86 swc compiled binaries).

  • we COULD but I was not able to get building for a different architecture working with docker regardless of what I tried.

Expected Behavior

This PR would allow us to set an env var to tell Nx to use ts-node even though swc-register is installed. This allows us to have local executions happening for all cases it can work, like dev'ing locally, or on most of our CI steps, but then set it to ts-node when we know we need it to fallback.

There may be another way to get around this I am missing so if there is I am more than happy to close this and do that!

Related Issue(s)

Fixes #

@vercel
Copy link

vercel bot commented Apr 1, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
nx-dev ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 3, 2023 11:14pm

Copy link
Member

@AgentEnder AgentEnder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes sense, I'd like to move forward with it.

Can you rename it and document it inside of environment-variables.md?

packages/nx/src/utils/register.ts Outdated Show resolved Hide resolved
@yharaskrik yharaskrik requested a review from AgentEnder April 3, 2023 23:05
@yharaskrik
Copy link
Contributor Author

This makes sense, I'd like to move forward with it.

Can you rename it and document it inside of environment-variables.md?

Done!

@github-actions
Copy link

This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 10, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants